package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("note.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.println("请输入你想要记录的事件：输入exit结束程序");
            String str = scanner.next();
            if (str.equals("exit")){
                break;
            }else{
                osw.write(str);
            }
        }
        osw.close();
    }
}
